package cn.zwx.member.svc.controller.dsitricts;

import cn.zwx.base.entity.ResponseEntity;
import cn.zwx.base.exception.BizWrapException;
import cn.zwx.member.svc.dto.DsitrictsListDTO;
import cn.zwx.member.svc.service.DsitrictsService;
import cn.zwx.member.svc.vo.DsitrictsListVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * @author zhangwenxue
 */
@RestController
@RequestMapping("/dsitricts")
@Api(tags = "区域相关相关接口")
public class DsitrictsController {

    private  final DsitrictsService dsitrictsService;

    public DsitrictsController(DsitrictsService dsitrictsService) {
        this.dsitrictsService = dsitrictsService;
    }


    /**
     * 查询地区信息
     * @param dto 请参数
     * @return 返回查询地区信息
     */
    @PostMapping("/getDistrictsList")
    @ApiOperation("查询地区信息")
    ResponseEntity<List<DsitrictsListVO>> getDistrictsList(@Valid @RequestBody DsitrictsListDTO dto) {
        return ResponseEntity.success(dsitrictsService.getDistrictsList(dto));
    }
}
